package la.iok.hzsvn.lewin.movie.controller;

import la.iok.hzsvn.lewin.movie.core.Token;
import la.iok.hzsvn.lewin.movie.entity.MovieEncryptCode;
import la.iok.hzsvn.lewin.movie.service.MovieEncryptCodeService;
import la.iok.hzsvn.share.response.SingleDataResponse;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("encryptCodes")
public class EncryptCodeController {
    private final MovieEncryptCodeService movieEncryptCodeService;

    public EncryptCodeController(MovieEncryptCodeService movieEncryptCodeService) {
        this.movieEncryptCodeService = movieEncryptCodeService;
    }

    @GetMapping("movie/{movieId}")
    public SingleDataResponse<MovieEncryptCode> movieEncryptCode(@RequestHeader Token token, @PathVariable Long movieId){
        return new SingleDataResponse<>(movieEncryptCodeService.movieEncryptCode(token, movieId));
    }
}
